home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / quartz / quartz10.lha / src / presto / stack.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-02  |  1.1 KB  |  59 lines

  1. //
  2. // Stack maintenance
  3. //
  4. // Modification History:
  5. //
  6. //   05-Dec-89  John Faust
  7. //   Remove all stack free lists.  Allocate stacks of fixed size when thread
  8. //   is allocated.  Stack remains associated with owning thread.  More
  9. //   efficient (removes search of stack freelist for stack of proper size,
  10. //   allocation of stack if one of proper size not found, and eliminates
  11. //   need to balance stack freelists).
  12. //
  13. //   16-Nov-1989  John Faust
  14. //   Add support for per-processor stack freelists.
  15. //
  16.  
  17. #include "presto.h"
  18.  
  19. Stack::Stack(int sz)
  20. {
  21.     register Stack *s = 0;
  22.  
  23.     if (this)    {
  24.         error("Can only allocate a stack on the heap");
  25.     }
  26.     
  27.     if (sz)    {
  28.         sz = sz &(~0x200);        // force page size boundaries
  29.     } 
  30.  
  31.         s = (Stack*) new char [sizeof (Stack)];
  32.         this = s;
  33. //cout << "stack ctor, stack size = " << sz << "\n";
  34.  
  35.         //
  36.         //  Init stack.
  37.         //
  38. //      stackcnt++;
  39.     st_base = (int*)new char[sz];
  40.     st_size = sz;
  41.     st_limit = sz;
  42. }
  43.  
  44.  
  45. //static shared_t stackcnt = 0;
  46. int
  47. Stack::numstacksbuilt()
  48. //    return stackcnt;
  49.         return -1;
  50. }        
  51.     
  52.  
  53.  
  54.     
  55.  
  56.             
  57.             
  58.